<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>个人中心</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/DDMBase.js"></script>
<link rel="stylesheet" href="${path }/resource/weixin/css/personal.css">
<!-- 文件上传需要的样式 -->
<link rel="stylesheet"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<script src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>

</head>
<body>


	<form class="form form-horizontal" method="post" style="display: none;"
		enctype="multipart/form-data" target="blankFrame"
		action="${path }/resource/plugin/kindeditor/upload_json.jsp?dir=image&flag=img_1&hiddenImg=hiddenImg&callBack=window.parent.uploadPhoto">

		<input id="fileText" type="file" multiple name="file-1"
			onchange="fileChange()" /> <input type="submit" id="submitBtn" />
	</form>
	<input id="hiddenImg" style="display: none;">
	<iframe src="" name="blankFrame" id="blankFrame"
		style="height: 100px; width: 100px; display: none;"> </iframe>


	<header data-am-widget="header" class="am-header back-y">
		<div class="am-header-left am-header-nav">
			<a href="${path }/index" class=""> <img
				src="${path }/resource/images/logo.png"> 
			</a>
		</div>

		<h1 class="am-header-title">
		<c:if test="${user.photo eq null or user.photo eq ''}">
						<a href="javascript:void(0)" class=""><img width="150" id='img_1'
							src="${path}/resource/images/logo.png"
							class="head-img1 am-circle" /></a>
					</c:if>
					<c:if test="${user.photo ne null and user.photo ne ''}">
						<a href="javascript:void(0)" class=""><img width="150" id='img_1' src="${user.photo}"
							class="head-img1 am-circle" /></a>
					</c:if>
		</h1>

		<div class="am-header-right am-header-nav ">
			<a href="javascript:void(0);" class="color-w">${user.name} </a><span class="color-w"> | </span>
			<a href="javascript:void(0);" onclick="esc();"class="color-w">退出</a>
		</div>
	</header>
	<div class="login-div">
		<a href="${path }/customer/redirect/house-class/" class="color-y back-w margin-1 padding-1 border-y">发布房源</a>
	</div>
	<!-- 内容 -->
	<ul class="am-avg-sm-2 title-ul msg-box  margin-10 back-w">
		<li class="text-center "><a href="${path }/customer/redirect/personal-msg" class="color-3"> <i
				class="am-header-icon am-icon-user "></i> <span class="">我的资料</span>
		</a></li>
		<li class="text-center "><a href="${path }/customer/redirect/myfy" class="color-3"> <i
				class="am-header-icon am-icon-star-o "></i> <span class="">我的发布</span>
		</a></li>
		<li class="text-center "><a href="${path }/customer/toJb?uuid=${user.validateCode}" class="color-3"> <i
				class="am-header-icon am-icon-venus "></i> <span class="">金币管理</span>
		</a></li>
		<li class="text-center "><a href="${path }/customer/redirect/orderList" class="color-3"> <i
				class="am-header-icon am-icon-file-text-o "></i> <span class="">订单管理</span>
		</a></li>
		<li class="text-center "><a href="${path }/customer/redirect/myfyLook" class="color-3"> <i
				class="am-header-icon am-icon-clock-o "></i> <span class="">游览记录</span>
		</a></li>
		<li class="text-center "><a href="${path }/customer/redirect/suggest" class="color-3"> <i
				class="am-header-icon am-icon-envelope-o "></i> <span class="">意见反馈</span>
		</a></li>
	</ul>
	<script type="text/javascript">
		var myForm;
		$(function() {
			
			//绑定点击事件
			$("#img_1").click(function(){
				$("#fileText").trigger("click");
			});
			
			
		});

		//检测文件改变事件
		function fileChange(){
			alert(1);
			if ($("#fileText").val() == '') {
				return;
			}
			$("#img_1"  ).attr("src",
					basePath + "/resource/images/loadingbig.gif");
			$("#submitBtn").trigger("click");
		}
		/*弹出*/
		function esc(){
			layer.open({
			    content: '确定退出登陆?'
			    ,btn: ['确定', '取消']
			    ,yes: function(index){			      
			      layer.close(index);
			      window.location.href="${path }/customer/loginOut";
			    }
			  });
		}
		
		/**
			开始上传图片
		 **/
		function uploadPhoto() {
			$.AjaxProxy({p:{photo:$('#img_1').attr('src')}}).invoke('${path}/customer/updatePhoto');
		}
	</script>
</body>
</html>